from django.urls import re_path
from meiduo_admin.views import users, skus
from meiduo_admin.views import statistical
from meiduo_admin.views import permissions

urlpatterns = [
    re_path(r'^authorizations/$', users.AdminAuthorizeView.as_view()),
    re_path(r'^statistical/day_active/$', statistical.UserDayActiveView.as_view()),
    re_path(r'^statistical/day_orders/$', statistical.UserDayOrdersView.as_view()),
    re_path(r'^statistical/month_increment/$', statistical.UserMonthCountView.as_view()),

    # 用户管理
    re_path(r'^users/$', users.UserInfoView.as_view()),

    # # 图片新增简单数据查询
    # re_path(r'skus/images/$', skus.SKUImageViewSet.as_view({
    #     'get': 'list',
    #     'post': 'create'
    # })),
    # re_path(r'skus/images/(?P<pk>\d+)/$', skus.SKUImageViewSet.as_view({
    #     'get': 'retrieve',
    #     'put': 'update',
    #     'delete': 'destroy'
    # })),
    re_path(r'^skus/simple/$', skus.SKUSimpleView.as_view()),
    re_path(r'^permission/content_types/$', permissions.PermissionViewSet.as_view({
        'get': 'content_types   '
    })),
    re_path(r'^permission/simple/$', permissions.GroupViewSet.as_view({
        'get': 'simple'
    })),
    re_path(r'^permission/groups/simple/$', permissions.AdminViewSet.as_view({
        'get': 'simple'
    }))

]

# 图片管理
from rest_framework.routers import SimpleRouter, DefaultRouter
router = SimpleRouter()
router.register('skus/images', skus.SKUImageViewSet, basename='images')
urlpatterns += router.urls

for url in router.urls:
    print(url)

# 权限管理
router = SimpleRouter()
router.register('permission/perms', permissions.PermissionViewSet, basename='perms')
urlpatterns += router.urls

# 用户组管理
router = SimpleRouter()
router.register('permission/groups', permissions.GroupViewSet, basename='groups')
urlpatterns += router.urls

# 管理员管理
router = SimpleRouter()
router.register('permission/admins', permissions.AdminViewSet, basename='admins')
urlpatterns += router.urls